package com.example.housemanage

import com.example.housemanage.entity.AddHouseManageEntity
import com.example.housemanage.entity.HouseManageEntity
import com.example.housemanage.entity.HouseManageEntityItem
import com.example.lib_base.mvvm.Res
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path

interface HouseManageApiService {
    @GET("http://10.161.9.80:2209/api/properties")
    suspend fun getProperties(): Res<HouseManageEntity> // 可根据实际返回类型替换 String

    @POST("http://10.161.9.80:2209/api/properties")
    suspend fun addProperty(@Body property: HouseManageEntityItem): Res<AddHouseManageEntity>

    @DELETE("http://10.161.9.80:2209/api/properties/{id}")
    suspend fun deleteProperty(@Path("id") id: Int): Res<Any>
    
    // 使用POST方法更新房屋信息，因为后端没有提供专门的更新API
    @POST("http://10.161.9.80:2209/api/properties")
    suspend fun updateProperty(@Body property: HouseManageEntityItem): Res<AddHouseManageEntity>
}